package com.wayne.utils;

import java.sql.SQLException;

public class TransactionManager {
  private ConnectionPool connectionPool;

  public void setConnectionPool(ConnectionPool connectionPool) {
    this.connectionPool = connectionPool;
  }

  public void beginTransaction() throws SQLException {
    connectionPool.getCurrentConnection().setAutoCommit(false);
  }

  public void commit() throws SQLException {
    connectionPool.getCurrentConnection().commit();
  }

  public void rollback() throws SQLException {
    connectionPool.getCurrentConnection().rollback();
  }
}
